package com.fyl.pattern.factory.static_factory;


/**
 * 咖啡工厂
 */
public class SimpleCoffeeFactory {
 public static Coffee CreateCoffee(String type){
     Coffee coffee = null;
     if("americian".equals(type)){
         coffee = new AmericanCoffee();
     }else if("latte".equals(type)){
         coffee = new LatteCoffee();
     }else {
         throw new RuntimeException("对不起，您点的咖啡没有了");
     }
     //加配料
     coffee.addMilk();
     coffee.addSugar();
     return coffee;
 }
}
